package ungdung_quanlymathang;

import com.example.quanly_mathang.R;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;


public class Ac_dangky extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dangky);
        
        
	}
	public void taonguoidung(View v){
		EditText ten=(EditText)findViewById(R.id.editText1);
        EditText mk=(EditText)findViewById(R.id.editText2);
        EditText mail=(EditText)findViewById(R.id.editText3);
        EditText dt=(EditText)findViewById(R.id.editText4);
        AlertDialog.Builder al=new AlertDialog.Builder(this);
        Cosodulieu csdl=new Cosodulieu(this);
        if(ten.getText().toString().trim().equals("") || mk.getText().toString().trim().equals("") )
      	al.setMessage("Khai báo tên đăng nhập và mật khẩu").setPositiveButton("OK", null).show();
        else{
        nguoi_dung nd= new nguoi_dung();
        nd.set_ten(ten.getText().toString());
        nd.set_matkhau(mk.getText().toString());
        nd.set_email(mail.getText().toString());
        nd.set_sodt(dt.getText().toString());
        csdl.them_nguoidung(nd);
        al.setMessage("Đăng ký thành công").setPositiveButton("OK", null).show();
        }
        ten.setText("");
        mk.setText("");
        mail.setText("");
        dt.setText("");
	}

    public void ac_dangnhap(View v){
    	Intent it=new Intent(this.getApplicationContext(),Ac_dangnhap.class);
    	startActivity(it);
    }    

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.dangky, menu);
        return true;
    }

    
}
